//===============================================================================
// Microsoft patterns & practices Enterprise Library Contribution
// Resource Application Block
//===============================================================================

using System;
using System.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;

namespace EntLibContrib.Resource.Configuration
{
	/// <summary>
	/// Configuration data defining ResourceProviderData. This configuration section defines the name and type
	/// of the IResourceProvider used by a ResourceManager
	/// </summary>
	[Assembler(typeof(TypeInstantiationAssembler<IResourceProvider, ResourceProviderData>))]
	public class ResourceProviderData : NameTypeConfigurationElement
	{
		#region Constants
		private const string resourceBaseNameProperty = "resourceBaseName";
		#endregion

		#region Properties
		/// <summary>
		/// Base name of the Resources to use.
		/// </summary>
		/// <value>The name of the resource base.</value>
		[ConfigurationProperty(resourceBaseNameProperty, IsRequired = true)]
		public string ResourceBaseName
		{
			get { return (string)base[resourceBaseNameProperty]; }
			set { base[resourceBaseNameProperty] = value; }
		}

		/// <summary>
		/// Gets the resource base name property.
		/// </summary>
		/// <value>The resource base name property.</value>
		public static string ResourceBaseNameProperty
		{
			get { return resourceBaseNameProperty; }
		}
		#endregion

		#region Construction
		/// <summary>
		/// Initializes a new instance of the <see cref="ResourceProviderData"/> class.
		/// </summary>
		public ResourceProviderData ()
		{
		}

		/// <summary>
		/// Initialize a new instance of the <see cref="ResourceProviderData"/> class with a name and the type of <see cref="IResourceProvider"/>.
		/// </summary>
		/// <param name="name">The name of the configured <see cref="IResourceProvider"/>.</param>
		/// <param name="resourceBaseName">Name of the resource base.</param>
		/// <param name="type">The type of <see cref="IResourceProvider"/>.</param>
		public ResourceProviderData(string name, string resourceBaseName, Type type)
			: base(name, type)
		{
			this.ResourceBaseName = resourceBaseName;
		}
		#endregion
	}
}